<div id="line" style="width: 500; height: 500px"></div>
<script type="text/javascript">
  var myChart = echarts.init(document.getElementById('line'));
  var option = {
    title: {
      text: "崩溃率趋势"
    },
    tooltip: {
      trigger: 'axis'
    },
    axisPointer: {
       show: true,
       type: 'shadow'
    },
    tooltip : {
      trigger: 'item',  
      formatter: "版本：{b} <br/>崩溃率({c}%)"
    },
    grid: {
        left: '3%',
        right: '4%',
        bottom: '3%',
    },
    toolbox: {
        feature: {
            magicType: {type: ['line', 'bar']},
            saveAsImage: {}
        }
    },
    xAxis: {
      type: 'category',
      data:  <%= raw @versions.map(&:version) %>
    },
    yAxis: {
      type: 'value'
    },
    series: [{
      type:'line',
      data: <%= raw @crash_rate %>,
      markPoint: {
        data: [
          {type: 'max', name: '最大值'},
          {type: 'min', name: '最小值'}
        ]
      },
      markLine: {
        label:{ position: 'start '},
        data: [
          {type: 'average', name: '平均值'}
        ]
      }
    }]
  };
  myChart.setOption(option);
</script>